const UPDATE_TITLE = 'react-promotion/title';

const initialState = {
  title: 'React Promotion'
};

export default function (state = initialState, action = {}) {
  switch (action.type) {
  case UPDATE_TITLE:
    return Object.assign({}, state, { title: action.title })
  default:
    return state;
  }
}

export const updateTitle = (title) => dispatch => {
  return dispatch({ type: UPDATE_TITLE, title });
}
